#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
if __name__=='__main__':
    temp_headers = {
        "authority": "api.nasdaq.com",
        "method": "GET",
        "path": "/api/quote/ARKF/historical?assetclass=etf&fromdate=2021-05-03&limit=18&todate=2021-08-02",
        "scheme": "https",
        "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
        "accept-encoding": "gzip, deflate, br",
        "accept-language": "zh-CN,zh;q=0.9",
        # "cookie": '_gcl_au=1.1.225347516.1622616363; _hjid=b6a6843d-4a0e-4465-b039-ed55f3717724; bfp_sn_rf_8b2087b102c9e3e5ffed1c1478ed8b78=Direct; usersync=eNqd0D0KgDAMBeC7ZO5gWpuqVxER0Q4F_7BFFPHuFsTddMwLHy_kgt1u3i0zVChgdYcdPVT1BW6IiRbgz7lvfei2EGeSkpC0-fJ-mdbRBhtXt3hNbn6b7DOoCn4R5ilIl_zzJBG_SRrFRwpTkE54uSLO95r7AWV9q4g.; _cc_id=497712385695067fe5fca647f0e8d637; recentlyViewedList=ARKQ|ETF,PRNT|ETF,IZRL|ETF,ARKW|ETF,ARKX|Stocks,ARKG|ETF,ARKF|ETF,ARKK|ETF; _fbp=fb.1.1624514885542.2064204685; bfp_sn_rt_8b2087b102c9e3e5ffed1c1478ed8b78=1625801486522; _gid=GA1.2.1629005976.1627894525; _ga=GA1.2.1681635705.1622616363; __gads=ID=70d37bf2cfffb965:T=1627894518:S=ALNI_MZKT8qRylmnqMNx2GuACA6SGVCl3Q; _uetsid=61213770f36f11ebbfa4b9b3dd6c61eb; _uetvid=40aa9da0c36e11eb8b6215124e6207a9; OptanonConsent=isGpcEnabled=0&datestamp=Mon+Aug+02+2021+16:55:56+GMT+0800+(中国标准时间)&version=6.20.0&isIABGlobal=false&hosts=&landingPath=https://www.nasdaq.com/market-activity/funds-and-etfs/arkk/historical&groups=C0004:0,C0001:1,C0003:0,C0002:0; RT="z=1&dm=nasdaq.com&si=2ed352cd-0a00-43ba-ae8f-49338292acca&ss=krued77c&sl=1&tt=tk1&bcn=//684fc536.akstat.io/&ld=tk1&ul=tk2&hd=tx2"; _ga_4VZJSZ76VC=GS1.1.1627894525.11.0.1627894559.0; NSC_W.OEBR.DPN.7070=ffffffffc3a0f73045525d5f4f58455e445a4a422dae; ak_bmsc=7A69619EBF495F53F397EA62A5533157~000000000000000000000000000000~YAAQP/APF09aC4R6AQAA912YCgy9x7W9v4O+0gD8u5C3/uk0v77hn/8WOZ6OCVNwRCY3OnCdNG1VgEjtcoBYgUzSzk1DAE8y2vwmAw3WSsj8CNz4nJ+KL/PiLzHBPbtdrg6uXy35dC/Sm2AFQ4y2VWVBvCpneGCMv6xHMw5MHZj1/bLikn67P/s6ns1JFcwKb1Xu7abNtjHu2cXYa1/KmLZxeHhUkOJmVcCUzs5ENupbG/iklcqn+CqtEYbCcrpNqcdM9vmDVzcJUunJKGvKlq3hDmZd5PplLsDdZahqI3NED2nfxA/sfLcJYsUPBXDEJH4yOVVhQFQcb9nbH+Sh0r6mG3dQHwyH7X801z7ByQDVajUGt+G23rKU3NgSILR9Brd4LhSpRUERg4GQ',
        "sec-ch-ua": "'Chromium';v='92', ' Not A;Brand';v='99', 'Google Chrome';v='92'",
        "sec-ch-ua-mobile": "?0",
        "sec-fetch-dest": "document",
        "sec-fetch-mode": "navigate",
        "sec-fetch-site": "none",
        "sec-fetch-user": "?1",
        "upgrade-insecure-requests": "1",
        "user-agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36'
    }
    url = 'https://api.nasdaq.com/api/quote/prnt/historical?assetclass=etf&fromdate=2021-05-03&limit=18&todate=2021-08-03'
    conn = requests.session()
    response = conn.get(url, headers=temp_headers, timeout=10)
    datas = response.content.decode('utf-8')
    print(datas)
    new_cookie = response.headers['Set-Cookie']
    print(new_cookie)
